CC = arm-himix200-linux-gcc
AR = arm-himix200-linux-ar
STRIP = arm-himix200-linux-strip
BASE_DIR =/home/edwin/hi3516dv300/hi3516dv300_rp_sdk/his3516dv300_rp
#BASE_DIR =/home/ly/hi3516dv300_rp_sdk/his3516dv300_rp
TARGET_PATH = $(shell pwd)
SRC_C = $(shell find . -name "*.c")
#SRC_H = $(shell find . -name "*.h")
OBJ_C = $(patsubst %.c, %.o, $(SRC_C))
OBJS = $(OBJ_C)
#OBJS = $(TARGET_PATH)/platform.o \
#	   $(TARGET_PATH)/main.o
TARGET = capture
MPI_LIBS = 		 $(BASE_DIR)/smp/a7_linux/mpp/lib/libmpi.a\
			 $(BASE_DIR)/smp/a7_linux/mpp/lib/libive.a\
		   	 $(BASE_DIR)/smp/a7_linux/mpp/lib/libhdmi.a
AUDIO_LIBA = $(BASE_DIR)/smp/a7_linux/mpp/lib/libVoiceEngine.a\
			 $(BASE_DIR)/smp/a7_linux/mpp/lib/libupvqe.a\
			 $(BASE_DIR)/smp/a7_linux/mpp/lib/libdnvqe.a\
			 $(BASE_DIR)/smp/a7_linux/mpp/lib/libtde.a
REL_LIB = $(BASE_DIR)/smp/a7_linux/mpp/lib
CFLAGS = -Wall -g -Dhi3516cv500 -DHI_XXXX -lpthread -lm -DISP_V2 -lstdc++ -lrt\
		-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -fno-aggressive-loop-optimizations -ldl -ffunction-sections \
		-fdata-sections -O2 -fstack-protector-strong -fPIC -DHI_RELEASE -Wno-error=implicit-function-declaration \
		-DVER_X=1 -DVER_Y=0 -DVER_Z=0 -DVER_P=0 -DVER_B=10 -DUSER_BIT_32 -DKERNEL_BIT_32 -Wno-date-time \
		-DSENSOR0_TYPE=OMNIVISION_OV426_MIPI_4M_30FPS_10BIT -DSENSOR1_TYPE=SONY_IMX327_MIPI_2M_30FPS_12BIT -DHI_ACODEC_TYPE_INNER -DHI_ACODEC_TYPE_HDMI \
		-I$(BASE_DIR)/include \
		-I$(BASE_DIR)/smp/a7_linux/mpp/include \
		-I$(BASE_DIR)/rtsp \
		-I$(BASE_DIR)/sample/common -I$(BASE_DIR)/sample/audio/adp \
		-I$(TARGET_PATH) -I$(TARGET_PATH)/lib/ucgui/GUI_X -I$(TARGET_PATH)/lib/ucgui/GUI/Core \
		-I$(TARGET_PATH)/lib/ucgui/GUI/WM -I$(TARGET_PATH)/lib/ucgui/GUI/Widget \
		-I$(TARGET_PATH)/lib/ucgui/Config -I$(TARGET_PATH) -I$(TARGET_PATH)/lib/osd \
		-I$(TARGET_PATH)/hardware/media -I$(TARGET_PATH)/hardware/gpio -I$(TARGET_PATH)/hardware/camera -I$(TARGET_PATH)/hardware/rs485_uart \
		-I$(TARGET_PATH)/hardware/usb -I$(TARGET_PATH)/lib/avi -I$(TARGET_PATH)/hardware/platform \
		-I$(TARGET_PATH)/lib/queue -I$(TARGET_PATH)/thread/key_thread -I$(TARGET_PATH)/thread/camera_thread \
		-I$(TARGET_PATH)/hardware/timer -I$(TARGET_PATH)/lib/osa -I$(TARGET_PATH)/thread/mainwindow_thread -I$(TARGET_PATH)/hardware/i2cled 

SENSOR_LIBS = $(BASE_DIR)/smp/a7_linux/mpp/lib/lib_hiae.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libisp.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/lib_hidehaze.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/lib_hidrc.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/lib_hildci.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/lib_hiawb.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_imx327.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_imx327_2l.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_imx307.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_imx458.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_mn34220.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_os05a.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_os01a.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_ov426.a\
              $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_ov9734.a\
			  $(BASE_DIR)/smp/a7_linux/mpp/lib/libsns_gc2093.a\

.PHONY : clean all
all: $(TARGET)
$(TARGET):$(OBJS)
	@$(CC) $(CFLAGS) -o $(TARGET_PATH)/$@ $^ -Wl,--start-group $(MPI_LIBS) $(SENSOR_LIBS) $(AUDIO_LIBA) $(REL_LIB)/libsecurec.a $(REL_LIB)/libsns_imx335.a -Wl,--end-group
	$(STRIP) $@
clean:
	@rm -f $(TARGET_PATH)/$(TARGET)
	@rm -f $(OBJS)

